package org.zbclan.bf2.rcon;

import java.util.Observable;
import java.util.Observer;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class ResourceCleaner implements ServletContextListener {

	private static final CleaningObservable INSTANCE = new CleaningObservable();

	public void contextInitialized(ServletContextEvent sce) {
	}

	public void contextDestroyed(ServletContextEvent sce) {
		INSTANCE.notifyObservers();
	}

	public static void addObserver(Observer o) {
		INSTANCE.addObserver(o);
	}

	private static class CleaningObservable extends Observable {

		private CleaningObservable() {
			setChanged();
		}
	}
}
